<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-row>
      <el-col :span='22' :xs='24'>
        <el-form ref="form" :model="s_pro_layout" :rules="rules" label-width="100px" id="mvcfm">
          <div class="form-unit">
            <span class="mvc-title-left"> 工位明细 </span>
          </div>
          <div>
            <el-row>
              <el-col :span="24">
                <el-form-item label="工序" prop="">
                  {{s_pro_layout.process_name}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <el-form-item label="工位" prop="position_name">
                  {{s_pro_layout.name}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <el-form-item label="工作能力" prop="">
                  {{s_pro_layout.work_able}}
                </el-form-item>
              </el-col>
            </el-row>
          </div>
          <el-button @click="gotoPage('/mes/product/SetStationAbility?'+vueparams+'')" type='success' size="mini"><i class='fa fa-edit'></i>修改工作能力</el-button>
          <div class="form-unit">
            <span class="mvc-title-left"> 工位设备 </span>
          </div>
          <el-table :data="s_layout_device">
            <el-table-column label="设备名称" prop="produce_name">
            </el-table-column>
            <el-table-column label="设备型号" prop="produce_model">
            </el-table-column>
            <el-table-column label="设备规格" prop="produce_norm">
            </el-table-column>
          </el-table>
          <div class="form-unit">
            <span class="mvc-title-left"> 模具夹具 </span>
          </div>
          <el-table :data="s_pro_device">
            <el-table-column label="设备名称" prop="produce_name">
            </el-table-column>
            <el-table-column label="设备型号" prop="produce_model">
            </el-table-column>
            <el-table-column label="设备规格" prop="produce_norm">
            </el-table-column>
          </el-table>
          <el-button @click="popSetStationDev('&CMIDSEL=2')" type='primary' size="mini">选择模具夹具</el-button>
        </el-form>
      </el-col>
      <el-col :span='2' :xs='24'>
        <el-menu default-active='active' class='menu-unit'>
          <el-menu-item v-for='item in Container'>
            <el-link @click="gotoMenu(item.url)" :type="'适用产品'===item.name?'primary':'default'">{{item.page_desc||item.name}}</el-link>
          </el-menu-item>
        </el-menu>
      </el-col>
    </el-row>
    <el-dialog :visible.sync="SetStationDevVisible" append-to-body>
      <SetStationDev v-if="SetStationDevVisible" ref="SetStationDev" :popparams="popparams"> </SetStationDev>
    </el-dialog>
  </div>
</template>
<script>
  import request from '@/utils/request'
  import SetStationDev from "@/views/mes/product/SetStationDev";
  export default {
    name: 'SetStationProcedure',
    components: {
      SetStationDev,
    },
    props: ['popparams'],
    data() {
      return {
        SetStationDevVisible: false,
        SetStationDevValue: null,
        SetStationDevDesc: null,
        vueparams: this.getVUEParams(""),
        s_pro_layout: {
          process_name: null,
          name: null,
          work_able: null,
        },
        s_layout_device: [],
        s_pro_device: [],
        loading: false,
        Container: null,
        rules: {}
      }
    },
    created() {
      this.getData();
      this.loadContainerMenu({
        pid: "28847805EE1D403DBCD43478FD18BD08",
        name: "工艺右菜单",
        selected: "适用产品"
      }, 'Container', this.vueparams);
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/mes/product/TechnologyAction/setStationProcedure?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      d_pro_device(_params) {
        request({
          method: 'post',
          url: '/xcapi/VUEAction/mes/product/TechnologyAction/d_pro_device?' + _params + this.vueparams,
          data: this.postData()
        }).then(data => {
          this.$router.replace("/redirect" + this.$route.fullPath);
          this.msgSuccess(data.msg);
        })
      },
      popSetStationDev(params) {
        if (params != "") this.popparams = params + this.vueparams;
        this.SetStationDevVisible = !this.SetStationDevVisible;
      },
    },
  }
</script>
